package com.lyf.shop.controller;

import com.lyf.shop.entity.Manage;
import com.lyf.shop.service.ManageService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Manage)表控制层
 *
 * @author makejava
 * @since 2021-12-09 12:59:46
 */
@Controller
@RequestMapping("manage")
public class ManageController {
    /**
     * 服务对象
     */
    @Resource
    private ManageService manageService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Manage selectOne(Integer id) {
        return this.manageService.queryById(id);
    }

    @RequestMapping("/allManage")
    public String list(Model model) {
        Manage manage = new Manage();
        List<Manage> list = manageService.queryAll(manage);
        model.addAttribute("list", list);
        System.out.println(list);
        return "jsp/lookManage";
    }

}